<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8" />
	<title>表单重复提交（多少毫秒）</title>
	<style type="text/css">
		.swfBtnWidth {
			width: 100px;
			height: 36px;
			color: #ffffff;
			border-radius: 4px !important;
			font-size: 12px !important;
			font-weight: normal;
		}

		.swfBtnGray {
			background-color: #C3CAD4;
		}

		.swfBtnOrange {
			background-color: #FF5722;
		}

		.swal-footer {
			text-align: center;
		}

		.swal-modal {
			width: 580px;
		}

		.swal-text {
			font-size: 14px;
			color: #434f64;
		}
	</style>
</head>

<body>
	<button type="button" onclick="sub()">提交</button>
	<script type="text/javascript" src="https://sweetalert.js.org/assets/sweetalert/sweetalert.min.js"></script>
	<script type="text/javascript">
		swal({
			text: '确定要退出编辑观察表页面',
			buttons: {
				confirm: {
					text: "退出",
					value: true,
					visible: true,
					className: "swfBtnWidth swfBtnGray",
					closeModal: true
				},
				cancel: {
					text: "继续编辑",
					value: null,
					visible: true,
					className: "swfBtnWidth swfBtnOrange",
					closeModal: true,
				}
			},
		}).then(function (res) {
			if (res == true) {
				swal({
					text: '退出了！',
					buttons: false,
					icon: 'warning',
					timer: 1500,
				});
			}
		});


		var isSub = false;

		function sub(argument) {
			if (isSub) {
				return;
			}
			isSub = true;
			swal({
				text: '确定要复制此观察表？',
				buttons: {
					confirm: {
						text: "确定",
						value: true,
						visible: true,
						className: "swfBtnWidth swfBtnOrange",
						closeModal: true
					},
					cancel: {
						text: "取消",
						value: null,
						visible: true,
						className: "swfBtnWidth swfBtnGray",
						closeModal: true,
					}
				},
			}).then(function (res) {
				if (res == true) {
					swal({
						text: '确定了',
						buttons: false,
						icon: 'warning',
						timer: 1500,
					});
				}
			});
			console.log('提交了');
			setTimeout(function () {
				isSub = false;
			}, 3000)
		}
	</script>
</body>

</html>